define(['jquery', 'jquery-validation', 'bootstrap/js/bootstrap-transition', 'bootstrap/js/bootstrap-modal'], function ($) {
	$(document).ready(function(){
	//	alert('test.js started...');
		$("#sampleForm").submit(function() {
			alert("Submitted!");
			$.ajax({
				url: 'service/form.json',
				type: 'post',
				data: {
					name: "ez a name",
					email: "ez az email",
					password: "ez a password"
				},
				success: function () {
					alert("AJAX Succeed!");
				},
				dataType: 'json'
			});
//			console.log($(this));
			return false;
		});
		
		$("#sampleForm1").validate({
		  
			rules: {
/*				username: {
				  required: true,
				  rangelength: [3, 15],
				  regexp: /^[a-zA-Z][\w\Q,.;:?!\E]*$/,
				  remote: {
					  url: "checkLogin",
					  type: "get"
				   }
				},
*/				
				name: {
					required: true,
					rangelength: [5, 30]
				},
				
				password: {
//					required: true,
					rangelength: [5, 10],
					regexp: /^[a-zA-Z][\w\Q,.;:?!\E]*$/
				},
				
				email: {
					required: true,
					email: true
				},
			},
		messages: {
			name: "Please enter your name",
/*			username: {
				required: "Please enter a username",
				minlength: "Your username must consist of at least 2 characters"
			},
*/			password: {
				required: "Please provide a password",
				minlength: "Your password must be at least 5 characters long"
			},
			email: {
				required: "Please provide an email",
				email: "Please enter a valid email address"
			}
		},		  
//		  errorPlacement: function(error, element) {
//			  console.log(element);
//			  element.parents(".control-group").addClass("error");
//		  },
		  
		  // use the following style to highlight incorrect input:
          errorClass: "validationError"
		});
		
		
	});
	return;
//	return {
//	};
});
